package com.lua.event;

import com.helper.Debug;
import com.lua.cache.LuaCache;
import net.sf.json.JSONObject;
import org.luaj.vm2.LuaValue;

public class callCommand extends JSONEvent{
    @Override
    public String op(String jb) {
        System.out.println(jb);
//        JSONObject jsonObject = JSONObject.fromObject(jb);
        JSONObject jsonObject = JSONObject.fromObject(jb);
        LuaValue vl = LuaCache.getService(jsonObject.getString("token")).
                get(jsonObject.getString("func")).
                call(jsonObject.getString("params"));

        Debug.log(vl.toString());
        return "success";
    }
}
